//获取各类型数据数据
import ajax from '@utils/ajax.js';

//获取学生数据
export async function getStudents({ currentPage, pageSize, type, value } = {}) {
    const res = await ajax({
        url: '/students/getStudents',
        data: {
            currentPage,
            pageSize,
            type,
            value,
        }

    });
    if (res.code) {
        return res.result
    } else {
        alert('学生数据获取失败');
    }
};


//获取专业数据
export async function getProfession({ currentPage, pageSize } = {}) {
    const res = await ajax({
        url: '/profession/getProfession',
        data: {
            currentPage,
            pageSize
        }
    });
    if (res.code) {
        return res.result
    } else {
        alert('专业数据获取失败');
    }
};


//获取班级数据
export async function getClasses({ currentPage, pageSize } = {}) {
    const res = await ajax({
        url: '/classes/getClasses',
        data: {
            currentPage,
            pageSize,
        }
    });
    if (res.code) {
        return res.result
    } else {
        alert('班级数据获取失败');
    }
};

// 获取专业连班级的数据
export async function getProfessionClasses({ professionId } = {}) {
    const res = await ajax({
        url: '/classes/getClassesProfession',
        data: {
            professionId
        }
    });
    if (res.code) {
        return res.result
    } else {
        alert('班级数据获取失败');
    }
};